﻿@model IEnumerable<WebUI.Models.QizSubject>
<ul id="tree">
    <li>
        <div class="tree-r" id="r_0">
            <div class="catalog-title">
                短信随访定义
                <span  class="toolbox">
                @Ajax.ActionLink("[新建]", "SmsQuizEdit", new { ID = string.Empty, utid = "treeview" }, new AjaxOptions() { LoadingElementId="OnLoadingSpan",UpdateTargetId = "dialogbox", OnComplete = "showDialog('短信随访单');", HttpMethod = "Get", InsertionMode = InsertionMode.Replace, OnFailure = "OnSiteError" })
                </span>
            </div>
            <div class="icons">
                
            </div>
        </div>
        <ul>
            @foreach (var s in Model.Where(v=>v.SubjectType!="指标库").OrderByDescending(v=>v.SortIdx))
            {
                <li>
                    <div class="tree-s" id="s_@(s.ID)">
                        @Html.DisplayFor(m => s.Title)
                    </div>
                    @if (s.QizSmsSubjects.Count > 0)
                    { 
                        <ul>
                            @foreach (var m in s.QizSmsSubjects.Where(v => v.DoctorID == SiteUser.UserId||SiteUser.IsDoctorDepManager))
                            {
                                
                                <li>
                                    <div class="tree-m" id="m_@(m.ID)" title="">
                                        @Ajax.ActionLink(m.Title, "SmsQuizDetail", new { ID = m.ID }, new AjaxOptions { LoadingElementId="OnLoadingSpan",UpdateTargetId = "listview", OnFailure = "OnSiteError" })
                                    </div>
                                </li>
                            }
                        </ul>
                    }
                </li>
            }
        </ul>
    </li>
</ul>
<script type="text/javascript">
    $(function () {

        $("#tree").treeview();
    });
</script>
